<form action="" class="form-horizontal" role="form">
	
	<div class="form-group">
	    <label class="col-sm-2 control-label">广告类型</label>
	    <div class="col-sm-2">
	    	<select class="form-control" id="type-select" name="ad_type" datatype="*">{$adPosition.adTypesOptions}</select>
	    </div>
	</div>
	
	<!-- 文本 -->
	<div class="form-group" id="type-text">
		<label class="col-sm-2 control-label">文本广告内容</label>
		<div class="col-sm-4 reply-txt">
			<textarea class="form-control" name="text" rows="5" id="txtContent">{$adPosition.text}</textarea>
		</div>
	</div>
	
	<!-- 图文 -->
	<div class="form-group" id="type-news" style="display:none;">
		<label class="col-sm-2 control-label">图文广告内容</label>
		<div class="col-sm-5">
			<div id="news-result">
				<ul class="news-edit-lists">
				</ul>
			</div>
		</div>
	</div>
	
	<div class="form-group">
		<div class="col-sm-offset-2 col-sm-8">
		    <input type="hidden" name="news" id="news-id" value="" />
		    <input type="hidden" name="id" value="{$adPosition.id}" />
			<button type="submit" class="btn btn-primary submit" data-loading-txt="提交中，请稍后……" data-ajax-url="__CONTROLLER__/modifyPost">保存更改</button>
		</div>
	</div>
</form>

<!-- 图文素材列表 -->
<section id="news">
	<ul class="news-lists" id="news-lists"></ul>
</section>

<script type="text/javascript">
	var news_data = {$partnerAdJSON};
</script>
<script type="text/javascript" src="__PUBLIC__/Style/Partner/Default/js/getNewsLists.js"></script>
<script type="text/javascript">
	$(function(){
		
		//初始化（设置文本还是图文显示）
		var type = $("#type-select option:selected").val(),
			pNum = 1,
			oText = $("#type-text"), 
			oNews = $("#type-news"), 
			oResult = $("#news-result ul"),
			news = $("#news"),
			selectId = {};
		
		if(type == "text"){
			oNews.hide();
			oText.show();
		}else if(type == "news"){
			oText.hide();
			oNews.show();
			oResult.show();
			news.show();
			$MoveTools.init();
		}
		
		$("#type-select").on("change", function(){
			var sel = $(this).val();
			if(sel == "text"){
				$("#type-news").hide();
				$("#type-text").show();
			}else if(sel == "news"){
				$("#type-text").hide();
				$("#type-news").show();
				$("#news").show();
				$MoveTools.init();
			}
		});

	});
</script>